package com.binance.assetservice.api;

import java.util.List;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import com.binance.assetservice.vo.request.product.FetchProductsRequest;
import com.binance.assetservice.vo.request.product.GetProductByRuleIdRequest;
import com.binance.assetservice.vo.request.product.GetProductItemRequest;
import com.binance.assetservice.vo.request.product.GetProductSnapshotRequest;
import com.binance.assetservice.vo.request.product.GetSumCirculationBySymbolRequest;
import com.binance.assetservice.vo.request.product.GetUserTradeFeeRequest;
import com.binance.assetservice.vo.request.product.PriceConvertRequest;
import com.binance.assetservice.vo.request.product.RefreshProductRequest;
import com.binance.assetservice.vo.request.product.RefreshUserTradeFeeRequest;
import com.binance.assetservice.vo.request.product.UpdateTradingProductAfterSetFeeRequest;
import com.binance.assetservice.vo.response.product.CurrencyResponse;
import com.binance.assetservice.vo.response.product.FetchProductsResponse;
import com.binance.assetservice.vo.response.product.GetUserTradeFeeResponse;
import com.binance.assetservice.vo.response.product.PriceConvertResponse;
import com.binance.assetservice.vo.response.product.ProductItemResponse;
import com.binance.master.configs.FeignConfig;
import com.binance.master.constant.Constant;
import com.binance.master.models.APIRequest;
import com.binance.master.models.APIRequest.VoidBody;
import com.binance.master.models.APIResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api
@FeignClient(name = Constant.ASSET_SERVICE, configuration = FeignConfig.class)
public interface IProductApi {

    // mbx调用的接口======================================================================
    // ================================================================================

    @PostMapping(value = "/mgmt/getVisibleSymbols", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public APIResponse<List<String>> getVisibleSymbols(@RequestBody APIRequest<VoidBody> request) throws Exception;

    @PostMapping(value = "/mgmt/getAllProducts", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public APIResponse<ProductItemResponse> getAllProducts(@RequestBody APIRequest<VoidBody> request) throws Exception;

    @PostMapping(value = "/mgmt/getProductItem", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public APIResponse<ProductItemResponse> getProductItem(@RequestBody APIRequest<GetProductItemRequest> request)
            throws Exception;

    @PostMapping(value = "/mgmt/updateTradingProduct", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public APIResponse<Void> updateTradingProductAfterSetFee(
            @RequestBody APIRequest<UpdateTradingProductAfterSetFeeRequest> request) throws Exception;

    @PostMapping(value = "/mgmt/getProductByRuleId", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public APIResponse<ProductItemResponse> getProductByRuleId(
            @RequestBody APIRequest<GetProductByRuleIdRequest> request) throws Exception;

    @PostMapping(value = "/mgmt/getSumCirculationBySymbol", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public APIResponse<Double> getSumCirculationBySymbol(
            @RequestBody APIRequest<GetSumCirculationBySymbolRequest> request) throws Exception;
    // ================================================================================



    // ================================================================================


    @ApiOperation(value = "")
    @PostMapping(value = "/public/product", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public APIResponse<List<FetchProductsResponse>> fetchProducts(
            @RequestBody @Validated APIRequest<FetchProductsRequest> request) throws Exception;

    @ApiOperation(value = "")
    @PostMapping(value = "/public/productSnapshot", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public APIResponse<Boolean> getProductSnapshot(
            @RequestBody @Validated APIRequest<GetProductSnapshotRequest> request) throws Exception;

    @ApiOperation(value = "刷新某个产品的缓存")
    @PostMapping(value = "/mgmt/refreshProduct", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public APIResponse<Void> refreshProduct(@RequestBody @Validated APIRequest<RefreshProductRequest> request)
            throws Exception;

    @ApiOperation(value = "刷新所有产品缓存")
    @PostMapping(value = "/mgmt/refreshProductList", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public APIResponse<Void> refreshProductAll(@RequestBody @Validated APIRequest<VoidBody> request) throws Exception;

    @ApiOperation(value = "获取用户汇总交易手续费")
    @PostMapping(value = "/public/userTradeFee", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public APIResponse<GetUserTradeFeeResponse> getUserTradeFee(
            @RequestBody @Validated APIRequest<GetUserTradeFeeRequest> request) throws Exception;

    @ApiOperation(value = "重置所有用户汇总交易手续费内存缓存")
    @PostMapping(value = "/mgmt/invalidateAllUserTradeFee", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public APIResponse<Void> invalidateAllUserTradeFee(@RequestBody @Validated APIRequest<VoidBody> request)
            throws Exception;

    @ApiOperation(value = "重置某个用户汇总交易手续费内存缓存")
    @PostMapping(value = "/asset-service/refreshUserTradeFee", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public APIResponse<Void> refreshUserTradeFee(@RequestBody @Validated APIRequest<RefreshUserTradeFeeRequest> request)
            throws Exception;


    @ApiOperation(value = "")
    @PostMapping(value = {"/public/convert"}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public APIResponse<PriceConvertResponse> priceConvert(
            @RequestBody @Validated APIRequest<PriceConvertRequest> request) throws Exception;

    @ApiOperation(value = "")
    @PostMapping(value = {"/mgmt/convert"}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public APIResponse<PriceConvertResponse> mgmtPriceConvert(
            @RequestBody @Validated APIRequest<PriceConvertRequest> request) throws Exception;

    @ApiOperation(value = "")
    @PostMapping(value = "/public/cnyusd", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public APIResponse<Double> cnyusd(@RequestBody @Validated APIRequest<VoidBody> request) throws Exception;

    @ApiOperation(value = "")
    @PostMapping(value = "/public/currency", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public APIResponse<CurrencyResponse> currency(@RequestBody @Validated APIRequest<VoidBody> request)
            throws Exception;

}
